package com.concurrency.example.singleton;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class SingletonExample1 {

    // 私有构造函数
    private SingletonExample1() {

    }

    // 单例对象
    private static SingletonExample1 instance = new SingletonExample1();

    // 静态的工厂方法
    public static SingletonExample1 getInstance() {
        return instance;
    }

    public static void main(String[] args) {
        System.out.println(getInstance().hashCode());
        System.out.println(getInstance().hashCode());
    }
}
